using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using Helper;
using System.Runtime.Serialization;
using CoreData;
namespace OpenIDHostController.DataContract
{
    [DataContract]
    public class module_serviceContract
    {
        [DataMember]
            public long serviceid{get;set;}
         [DataMember]
            public long moduleid{get;set;}

         public module_serviceContract()
        {       
        }

         public static module_serviceContract ToContract(module_service data)
        {
            try
            {
                var model = ConvertObject.ConvertToObject(new module_serviceContract());
                Helper.ConvertObject.ConvertEntityToModel(data, ref model);
                return (module_serviceContract)model;
            }
            catch
            {
                return null;
            }
        }
         public static module_service ToCoreData(module_serviceContract data)
        {
            try
            {
                var model = ConvertObject.ConvertToObject(new module_service());
                Helper.ConvertObject.ConvertEntityToModel(data, ref model);
                return (module_service)model;
            }
            catch
            {
                return null;
            }
        }

         public static IList<module_service> ToListCoreData(IList<module_serviceContract> data)
        {
            var list = new List<module_service>();
            foreach (var item in data)
            {
                var model = ConvertObject.ConvertToObject(new module_service());
                Helper.ConvertObject.ConvertEntityToModel(item, ref model);
                if (model != null)
                {
                    list.Add((module_service)model);
                }
            }
            if (list.Count <= 0)
                return null;
            return list;
        }
         public static IList<module_serviceContract> ToListConTract(IList<module_service> data)
        {
            var list = new List<module_serviceContract>();
            foreach (var item in data)
            {
                var model = ConvertObject.ConvertToObject(new module_serviceContract());
                Helper.ConvertObject.ConvertEntityToModel(item, ref model);
                if (model != null)
                {
                    list.Add((module_serviceContract)model);
                }
            }
            if (list.Count <= 0)
                return null;
            return list;
        }
        
    }
}
